<?php

namespace App\HttpController\Api;

use App\Core\Output;
use App\Logic\UploadService;
use EasySwoole\Http\Message\Status;


class Upload extends BaseController {

    public function index(){
        //获取图片
        $request = $this->request();
        $file = $request->getUploadedFile('file');

        $uploadImg = new UploadService();
        $path = $uploadImg->upload($file);

        return $this->writeJsonByOutput($path);
    }
}
